package Booking.user;

import Booking.BookList;
import Booking.operation.IOperation;
import Booking.operation.impl.*;

import java.util.Scanner;

public class Main {
    private static Scanner scanner=new Scanner(System.in);

    public static void main(String[] args) {
        User user = login();
        BookList bookList = new BookList();
        while (true) {
            int choice = user.menu();
            if (choice == -1) {
                System.out.println("ByeBye ~~");
                break;
            }
            user.doOpreation(choice,bookList);
        }


    }
    public static User login()
    {
        System.out.println("请输入用户名");
        String name =scanner.next();
        System.out.println("q请选择你的身边，1表示普通用户，0表示管理员");
        int choice = scanner.nextInt();
        if (choice == 1) {
            return new NormalUser(name);
        }
        return new ManngerUser(name);
    }
}
